// const path = require("path");
// const resolve = (dir) => path.join(__dirname, dir);
// const IS_PROD = ["production", "prod"].includes(process.env.NODE_ENV);
// const webpack = require('webpack');
// // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// const CompressionWebpackPlugin = require("compression-webpack-plugin");
// const zopfli = require("@gfx/zopfli");
// const BrotliPlugin = require("brotli-webpack-plugin");
//
// const productionGzipExtensions = /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i;


let env = (() => {
    if (process.env.NODE_ENV === 'development') {
        return `${process.env.VUE_APP_DEV_ENV}.`
    } else if (process.env.NODE_ENV === "daily" || process.env.NODE_ENV === "pre") {
        return `${process.env.NODE_ENV}.`
    }
    return ''
})();

console.log(`=========env环境:${env}==========`);
console.log(`=========NODE_ENV环境:${process.env.NODE_ENV}==========`);
console.log(`=========VUE_APP_DEV_ENV环境:${process.env.VUE_APP_DEV_ENV}==========`);

module.exports = {
    outputDir: "build/static",
    indexPath: "../pages/index.html",
    publicPath: process.env.NODE_ENV === "development" ? "/" : `http://fly.viicb.com/lwsc/build/static/`,
    devServer: {
        open: true, // 是否打开浏览器
        host: "dev.vdian.net",
        port: "8099", //
        // https: true,
        https: false,
        hotOnly: true, // 热更新
        disableHostCheck: true,
        proxy: {
            "/api": {
                target: `http://134.175.149.136:8090`,
                secure: false,
                changeOrigin: true, // 开启代理，在本地创建一个虚拟服务端
                pathRewrite: {
                    "^/api": "/",
                }
            }
        },
    }
};